其他
靠,上班打游戏!不,我只是在Minecraft里管理Kubernetes...
The following article is from 云原生实验室 Author 米开朗基杨
Kubernetes
集群中的容器,每一个房子代表一个 Pod
,房子里面有开关可以销毁 Pod
,真是太好玩了(太无聊了......)。Docker
跑的,命令如下:--name kubecraft \
-e KUBE_CFG_FILE=/etc/kubeconfig \
-v ~/.kube/config:/etc/kubeconfig \
stevesloka/kubecraft
kind: Deployment
metadata:
name: kubecraft
labels:
app: kubecraft
spec:
replicas: 1
selector:
matchLabels:
app: kubecraft
template:
metadata:
labels:
app: kubecraft
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kubecraft
topologyKey: kubernetes.io/hostname
weight: 1
tolerations:
- key: node-role.kubernetes.io/ingress
operator: Exists
effect: NoSchedule
containers:
- name: kubecraft
image: stevesloka/kubecraft
tty: true
stdin: true
env:
- name: KUBE_CFG_FILE
value: /etc/kubeconfig
ports:
- containerPort: 25565
protocol: TCP
volumeMounts:
- mountPath: /etc/kubeconfig
subPath: kubeconfig
name: kubeconfig
volumes:
- name: kubeconfig
configMap:
name: kubeconfig
---
apiVersion: v1
kind: Service
metadata:
name: kubecraft
labels:
app: kubecraft
spec:
selector:
app: kubecraft
ports:
- protocol: TCP
name: http
port: 25565
targetPort: 25565
tty: true
和 stdin:true
,不然容器无法启动!Configmap
来保存 kubeconfig
,例如:KubeCraftAdmin
,功能上并没有什么太大的差异,只是每一个动物代表一个 Pod,你只要干掉一只鸡🐔,Kubernetes 中的 Pod 就被干死了,刺不刺激?KubeCraftAdmin
项目地址。参考资料
Dockercraft: https://github.com/docker/dockercraft
[2]Dockercraft: https://github.com/docker/dockercraft
[3]Kubecraft: https://github.com/stevesloka/kubecraft
[4]官方仓库: https://github.com/stevesloka/kubecraft
往期推荐
云原生是一种信仰 🤘
扫码关注公众号
后台回复◉k8s◉获取史上最方便快捷的 Kubernetes 高可用部署工具,只需一条命令,连 ssh 都不需要!
﹀
﹀
﹀
推荐加入
最近热门内容回顾 #技术人系列